<template>
  <div class="addVideo">
    <el-form :model="query" label-width="100px">
      <el-row>
        <el-col :span="10">
          <el-form-item label="公告名称">
            <div>{{ query.noticeName }}</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item
            label="原文链接"
          >
            <div>{{ query.noticeCategory }}</div>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item
            label="概要"
          >
            <div v-html="query.policySummary"></div>
          </el-form-item>
        </el-col>
      </el-row>
          <el-row>
        <el-col :span="12">
          <el-form-item
            label="公告内容"
          >
            <div v-html="query.noticeContent"></div>
          </el-form-item>
        </el-col>
      </el-row>

           <el-row>
        <el-col :span="12">
          <el-form-item
            label="相关附件"
          >
        <el-upload
        disabled
  class="upload-demo"
   :action="$upload"
     :headers="$headers()"
          :on-preview="
            (e) => {
              $downloadFiles(e.fileUrl);
            }
          "
  :file-list="query.list">
</el-upload>
          </el-form-item>
        </el-col>
      </el-row>


           <el-row>
        <el-col :span="12">
          <el-form-item
            label="政策解读"
          >
        <el-upload
        disabled
  class="upload-demo"
   :action="$upload"
     :headers="$headers()"
          :on-preview="
            (e) => {
              $downloadFiles(e.fileUrl);
            }
          "
  :file-list="query.unscrambleFileList">
</el-upload>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
export default {
  props: {},
  data() {
    return {
     query: {
        creaeUnitId: 23342113,
        creaeUnitName: "苏州市市场监督管理局",
        id: "",
        list: [],
        noticeCategory: "",
        noticeContent: "",
        noticeName: "",
        noticeState: 0,
        unscrambleFileList:[]
      },
    };
  },
  computed: {
  
  },
  created() {
      if(this.$route.query.id){
        this.findById(this.$route.query.id)
    }
  },
  mounted() {},
  destroyed() {
  },
  methods:{
          findById(id){
      this.$http
              .policyFindById({
                params:{
                  id,
                }
              })
              .then((res) => {
                if (res.code == 200) {
                    console.log(res.data);
res.data.list.forEach(x=>{
    x.name=x.fileName
  })


res.data.unscrambleFileList.forEach(x=>{
    x.name=x.fileName
  })
  this.query.creaeUnitId=res.data.creaeUnitId
  this.query.creaeUnitName=res.data.creaeUnitName
  this.query.noticeCategory=res.data.policyCategory
  this.query.noticeContent=res.data.policyContent
  this.query.noticeName=res.data.policyName
  this.query.list=res.data.list
  this.query.unscrambleFileList=res.data.unscrambleFileList
  this.query.policySummary=res.data.policySummary

  
                } else {
                  console.log(res);
                  this.$error(res.msg);
                }
              })
              .catch((err) => {
                console.log(err);
                this.$error();
              });
    },
  }
};
</script>
<style scoped lang="scss">
.is-required {
  /deep/.hide .el-upload--picture-card {
    display: none;
  }
}
</style>

